Skip to content

Stevenh/availability#17

Open
stevenhuang010 wants to merge 12 commits intomainfrom
stevenh/availability
Open

Stevenh/availability#17
stevenhuang010 wants to merge 12 commits intomainfrom
stevenh/availability

Conversation

@stevenhuang010
Copy link
Copy Markdown
Contributor

@stevenhuang010 stevenhuang010 commented Apr 20, 2023

What's new in this PR

Description

Filled in the functions in availabilityHelper.ts
const createListOfUsersForShift = (shiftObject: Shift, entityState: EntityState, days: string[])

  • given a list of users, returns a sorted list of available and eligible users
    const filterUsersByAvailability = (shiftObject: Shift, days: string[], entityState: EntityState)
  • returns a list of user ids that are available to complete the shift
    const filterUsersByEligibility = (ids: EntityId[], entityState: EntityState, creditHours: number, shiftID: string)
  • returns a list of user ids that are eligible (hoursUnassigned >= creditHours for the shift/already assigned to the shift)
    const sortUsersByNeededHoursAndPreference = (ids: EntityId[], entityState: EntityState, shiftObject: Shift)
  • sorts users (first by preference), then by unassigned hours
  • commented this out in shiftApiSlice because the schema should store all times in military format as strings
    // if (!entity.timeWindowDisplay) {
    // entity.timeWindowDisplay =
    // formatMilitaryTime(entity.timeWindow.startTime) +
    // ' - ' +
    // formatMilitaryTime(entity.timeWindow.endTime)
    // }

Screenshots

How to review

ShiftAssignmentHelper.tsx in the testing folder can be imported and put into any rendered component. inspect the console.log to see the outputted list.
check the shift named danashi

Next steps

stuff found: make sure firebase availabilities day (monday) is lowercase, shift times must be valid (end time and start time must have enough time to complete the shift-MUST BE ENFORCED IN THE SHIFT CREATION CARD)

// TODO: DOESN'T WORK IF SOMEONE IS ALREADY ASSIGNED DURING THEIR AVAILABILITY PERIOD TO A DIFFERENT SHIFT

Relevant Links

Online sources

Related PRs

CC: @gregoriiaaa

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bsc-web-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 27, 2023 3:47am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants